package com.changli01.net;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAddressTest {
    public static void main(String[] args) {
        try {
            InetAddress inet = InetAddress.getByName("127.192.23.25");
//            System.out.println(inet);
            InetAddress inet2 = InetAddress.getByName("www.atguigu.com");
//            System.out.println(inet2);
//            InetAddress localHost = InetAddress.getLocalHost();
//            System.out.println(localHost);
            System.out.println(inet.getHostName());
            System.out.println(inet2.getHostAddress());

        } catch (UnknownHostException e) {
            throw new RuntimeException(e);
        }

    }
}
